home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / iso9660 / mail / mh / vmail / vmailtl / vmailtool < prev   
Encoding:
Text File  |  1991-04-05  |  15.7 KB  |  826 lines

  1. :
  2. # vmailtool
  3. #
  4. # James T. Perkins
  5. #
  6. # $Id: vmailtool,v 1.15 91/03/01 14:03:01 jamesp Exp $
  7.  
  8. TMP=/tmp/vmailtool.$$
  9.  
  10. NOMAILICON="${NOMAILICON:-/usr/include/images/nomail.icon}"
  11. MAILICON="${MAILICON:-/usr/include/images/mail.icon}"
  12. BOLD_FONT="${BOLD_FONT:-/usr/lib/fonts/fixedwidthfonts/screen.b.14}"
  13. REVISION="V`set $Revision: 1.15 $ ; echo \$2`"
  14. DATE="`set $Date: 91/03/01 14:03:01 $ ; echo \$2`"
  15.  
  16. if stty 2>&1 >/dev/tty | grep -s tostop
  17. then
  18.     echo "vmailtool: vmailtool and 'stty tostop' are incompatible.  See the man page." >&2
  19.     exit 1
  20. fi
  21.  
  22. trap 'status=$?; rm $TMP; exit $status' 0 1 2 15
  23.  
  24. cat >$TMP <<END-OF-TOOLTOOL-SCRIPT
  25. /*
  26.  * vmailtool $REVISION tooltool file
  27.  * James Perkins $DATE
  28.  */
  29.  
  30. #define APPLICATION    "vmail"
  31. #define VMAILICON    "/usr/public/bin/vmailicon"
  32. #define ICON_MAIL    "$MAILICON"
  33. #define ICON_NOMAIL    "$NOMAILICON"
  34. #define MAIL_LABEL    '$MAILICON'
  35. #define NOMAIL_LABEL    '$NOMAILICON'
  36. #define ICON_UP        '/usr/public/icons/up'
  37. #define ICON_DOWN    '/usr/public/icons/down'
  38. #define ICON_LEFT    '/usr/public/icons/left'
  39. #define ICON_RIGHT    '/usr/public/icons/right'
  40. #define LABEL        "Vmail/MH Tool - $REVISION - $DATE - JTP"
  41. #define ROW_SIZE    34
  42. #define COL_SIZE    80
  43. #define BOLD_FONT    "$BOLD_FONT"
  44.  
  45. /*
  46.  * icon_flag_up/icon_flag_down - these strings are echoed to the tty when mail
  47.  * arrives or is incorporated.  They cause the tooltool icon to change to
  48.  * indicate arrival of mail, or no mail.
  49.  */
  50.  
  51. #define    icon_flag_up    format("%s %s", VMAILICON, ICON_MAIL)
  52. #define    icon_flag_down    format("%s %s", VMAILICON, ICON_NOMAIL)
  53.  
  54. /*
  55.  * types of dialog boxes.  We only have one dialog box, and it switch-hits
  56.  * between each kind of dialog box.  This is necessary becuase tooltool
  57.  * eats up one extra window for each dialog box -- if there were a dialog
  58.  * box for each one of these, tooltool would eat up a lot of windows.
  59.  */
  60.  
  61. #define REFILE        0
  62. #define COMP        1
  63. #define REPL        2
  64. #define FORW        3
  65. #define SEARCH        4
  66. #define NEW_FOLDER    5
  67. #define PIPE        6
  68. #define DIST        7
  69. #define BURST        8
  70. #define SORT        9
  71.  
  72. /*
  73.  * define overall application
  74.  */
  75.  
  76. application APPLICATION
  77. icon ICON_NOMAIL
  78. label LABEL
  79. size ROW_SIZE by COL_SIZE characters
  80.  
  81. /*
  82.  * Do the following when we start up
  83.  */
  84. initialize {
  85.     /*
  86.      * initialize dialog box
  87.      */
  88.  
  89.     dialog_box_first_time = 1;
  90.  
  91.     /*
  92.      * get mpath (path of system maildrop) from MAILPATH, MAIL, or USER
  93.      * environment variables.
  94.      */
  95.  
  96.     if (length(mpath = getenv("MAILPATH")) > 0) {
  97.         endpath = index(mpath, "?");
  98.         mpath = substr(mpath, 1, (endpath - 1));
  99.     }
  100.     else if (length(mpath = getenv("MAIL")) > 0) {
  101.         ;
  102.     }
  103.     else {
  104.         user = getenv("USER");
  105.         mpath = format("/usr/spool/mail/%s", user);
  106.     }
  107.  
  108.     /*
  109.      * get NEWMAILCMD environment variable.  The shell command in
  110.      * newmailcmd is executed every time new mail arrives.
  111.      */
  112.  
  113.     newmailcmd = getenv("NEWMAILCMD");
  114.     lastsize = 0;
  115.     cursize = 0;
  116.  
  117.     /*
  118.      * Pop up flag (both the icon and the mail label) if there's mail
  119.      */
  120.  
  121.     remove mail_label;
  122.     if (exists(mpath)) {
  123.         st = stat(mpath);
  124.         cursize = st["size"];
  125.         if (cursize > lastsize) {
  126.         system(icon_flag_up);
  127.         remove nomail_label;
  128.         display mail_label;
  129.         }
  130.     }
  131.     lastsize = cursize;
  132.  
  133.     /*
  134.      * Set up new mail test timer, based on MAILCHECK environment variable.
  135.      * timeout will never exceed 60 seconds.
  136.      */
  137.     
  138.     if ((interval = getenv("MAILCHECK")) < 60) {
  139.         interval = 60;
  140.     }
  141. }
  142.  
  143.  
  144. /*
  145.  * Do the following when the window is opened
  146.  */
  147.  
  148. open {}
  149.  
  150. /*
  151.  * Do the following when the window is closed
  152.  */
  153.  
  154. close {}
  155.  
  156. /*
  157.  * Do the following asychronously, whenever the "interval" timer times out.
  158.  */
  159.  
  160. timer {
  161.     /*
  162.      * Pop up flag if there's mail (both icon and mail label)
  163.      */
  164.  
  165.     if (exists(mpath)) {
  166.         st = stat(mpath);
  167.         cursize = st["size"];
  168.         if (cursize > lastsize) {
  169.         system(icon_flag_up);
  170.         remove nomail_label;
  171.         display mail_label;
  172.         if (length(newmailcmd) > 0) {
  173.             system(newmailcmd);
  174.         }
  175.         }
  176.         else {
  177.         if (cursize == 0 && lastsize != 0) {
  178.         remove mail_label;
  179.         display nomail_label;
  180.         }
  181.         }
  182.     }
  183.     lastsize = cursize;
  184. }
  185.  
  186. /*
  187.  * Define all buttons and menus for the application
  188.  */
  189.  
  190. gadgets
  191.     /*
  192.      * Button labels are right justified and not adjusted.
  193.      */
  194.  
  195.     right
  196.     ragged
  197.  
  198.     /*
  199.      * Gadgets at default places
  200.      */
  201.  
  202.     button mail_label    /* Copy of tooltool icon */
  203.         at 5 5
  204.         normal    MAIL_LABEL {
  205.             close;
  206.         }
  207.         control    "quit"    {
  208.             exit;
  209.         }
  210.     end_button
  211.     button            /* incorporate mail */
  212.         normal    "inc"    {
  213.             remove mail_label;
  214.             display nomail_label;
  215.             system(icon_flag_down);
  216.             send "i";
  217.         }
  218.         shift    "inc show"    {
  219.             remove mail_label;
  220.             display nomail_label;
  221.             system(icon_flag_down);
  222.             send "i ";
  223.         }
  224.     end_button
  225.     label            /* blank lines to leave room for arrows */
  226.         ""
  227.     end_label
  228.     label
  229.         ""
  230.     end_label
  231.     label
  232.         ""
  233.     end_label
  234.     label
  235.         ""
  236.     end_label
  237.     label
  238.         "-MESSAGE-" : BOLD_FONT
  239.     end_label
  240.     button            /* show current message */
  241.         normal    "show"    {
  242.             send " ";
  243.         }
  244.         shift    "print"    {
  245.             printer = getenv("PRINTER");
  246.             if (length(printer) > 0) {
  247.                 printer = format(" -P%s", printer);
  248.             }
  249.             send(format("|(echo Printing...; lpr%s)\n ", printer));
  250.         }
  251.         control    "pipe"    {
  252.             dialog_type = PIPE;
  253.             popup dialog_box;
  254.         }
  255.     end_button
  256.     button            /* delete current message */
  257.         normal    "delete" {
  258.             send "d";
  259.         }
  260.         shift    "undo delete" {
  261.             send "u";
  262.         }
  263.     end_button
  264.     button            /* refile current message */
  265.         normal    "refile" {
  266.             dialog_type = REFILE;
  267.             popup dialog_box;
  268.         }
  269.         shift    "again"    {
  270.             if (length(refile_cmd) > 0) {
  271.                 send(refile_cmd);
  272.             }
  273.             else {
  274.                 dialog_type = REFILE;
  275.                 popup dialog_box;
  276.             }
  277.         }
  278.         control    "to prev folder"    {
  279.             send "R";
  280.         }
  281.     end_button
  282.     label
  283.         ""
  284.     end_label
  285.     button            /* compose new message */
  286.         normal    "comp"    {
  287.             send "c\n";
  288.         }
  289.         shift    "comp..."    {
  290.             dialog_type = COMP;
  291.             popup dialog_box;
  292.         }
  293.     end_button
  294.     button            /* reply to current message */
  295.         normal    "repl"    {
  296.             send "a\n";
  297.         }
  298.         shift    "repl..."    {
  299.             dialog_type = REPL;
  300.             popup dialog_box;
  301.         }
  302.     end_button
  303.     button            /* forward current message */
  304.         normal    "forw"    {
  305.             send "f\n";
  306.         }
  307.         shift    "forw..."    {
  308.             dialog_type = FORW;
  309.             popup dialog_box;
  310.         }
  311.     end_button
  312.     menu "misc"
  313.         "rescan" {
  314.             send "^R";
  315.         }
  316.         "edit" {
  317.             send "e";
  318.         }
  319.         "burst" {
  320.             send "b\n";
  321.         }
  322.         "burst..." {
  323.             dialog_type = BURST;
  324.             popup dialog_box;
  325.         }
  326.         "dist" {
  327.             send "t\n";
  328.         }
  329.         "dist..." {
  330.             dialog_type = DIST;
  331.             popup dialog_box;
  332.         }
  333.     end_menu
  334.     label
  335.         ""
  336.     end_label
  337.     label
  338.         "-FOLDER-" : BOLD_FONT
  339.     end_label
  340.     button            /* search folder for subject line */
  341.         normal    "search"    {
  342.             if (length(search_cmd) > 0) {
  343.                 send(search_cmd);
  344.             }
  345.             else {
  346.                 beep;
  347.             }
  348.         }
  349.         shift    "forward..."    {
  350.             search_dir = "/";
  351.             dialog_type = SEARCH;
  352.             popup dialog_box;
  353.         }
  354.         control    "backward..."    {
  355.             search_dir = "?";
  356.             dialog_type = SEARCH;
  357.             popup dialog_box;
  358.         }
  359.     end_button
  360.     button            /* go to new folder */
  361.         normal    "new fold"    {
  362.                 dialog_type = NEW_FOLDER;
  363.                 popup dialog_box;
  364.             }
  365.         shift    "alternate"    {
  366.                 if (length(new_folder_cmd) > 0) {
  367.                     send "G";
  368.                 }
  369.                 else {
  370.                     dialog_type = NEW_FOLDER;
  371.                     popup dialog_box;
  372.                 }
  373.             }
  374.     end_button
  375.     Menu    "misc"        /* misc folder commands */
  376.         "List All" {
  377.             send "F";
  378.         }
  379.         "Pack"    {
  380.             send "z";
  381.         }
  382.         "Sort"    {
  383.             send "S\n";
  384.         }
  385.         "Sort..."    {
  386.             dialog_type = SORT;
  387.             popup dialog_box;
  388.         }
  389.         "Inactivate"    {
  390.             send "v";
  391.         }
  392.     end_menu
  393.  
  394.     /*
  395.      * Gadgets at particular places
  396.      */
  397.  
  398.     button nomail_label        /* copy of tooltool icon */
  399.         at 5 5
  400.         normal    NOMAIL_LABEL {
  401.             close;
  402.         }
  403.         control    "quit"    {
  404.             exit;
  405.         }
  406.     end_button
  407.     button                /* make prev message current */
  408.         at 30 110
  409.         normal    ICON_UP    {
  410.             send "k";
  411.         }
  412.         shift    "home"    {
  413.             send "H";
  414.         }
  415.     end_button
  416.     button                /* go to prev page of messages */
  417.         at 10 130
  418.         normal    ICON_LEFT    {
  419.             send "\b";
  420.         }
  421.         shift    "prev folder"    {
  422.             send "p";
  423.         }
  424.     end_button
  425.     button                /* go to next page of messages */
  426.         at 50 130
  427.         normal    ICON_RIGHT    {
  428.             send "\r";
  429.         }
  430.         shift    "next folder"    {
  431.             send "n";
  432.         }
  433.     end_button
  434.     button                /* make next message current */
  435.         at 30 150
  436.         normal    ICON_DOWN    {
  437.             send "j";
  438.         }
  439.         shift    "last line"    {
  440.             send "L";
  441.         }
  442.     end_button
  443. end_gadgets
  444.  
  445. /*
  446.  * Here's the dialog box that does everything.
  447.  * The first time it is opened, it removes everything in it except for
  448.  * the "done" and "cancel" buttons.
  449.  * Then, any time it is opened it adds the fields it needs, and when it
  450.  * is closed it removes them.
  451.  */
  452.  
  453. dialog dialog_box
  454.     size 24 by 43 characters
  455.     open {
  456.         if (dialog_box_first_time == 1) {
  457.             dialog_box_first_time = 0;
  458.             remove refile_label;
  459.             remove refile_folder;
  460.             remove comp_label;
  461.             remove comp_opts;
  462.             remove forw_label;
  463.             remove forw_opts;
  464.             remove repl_label;
  465.             remove repl_opts;
  466.             remove search_label;
  467.             remove search_regex;
  468.             remove new_folder_label;
  469.             remove new_folder;
  470.             remove pipe_label;
  471.             remove pipe_cmd;
  472.             remove burst_label;
  473.             remove burst_opts;
  474.             remove dist_label;
  475.             remove dist_opts;
  476.             remove sort_label;
  477.             remove sort_opts;
  478.         }
  479.         if (dialog_type == REFILE) {
  480.             refile_folder = last_refile_folder;
  481.             display refile_label;
  482.             display refile_folder;
  483.         }
  484.         else if (dialog_type == COMP) {
  485.             comp_opts = last_comp_opts;
  486.             display comp_label;
  487.             display comp_opts;
  488.         }
  489.         else if (dialog_type == FORW) {
  490.             forw_opts = last_forw_opts;
  491.             display forw_label;
  492.             display forw_opts;
  493.         }
  494.         else if (dialog_type == REPL) {
  495.             repl_opts = last_repl_opts;
  496.             display repl_label;
  497.             display repl_opts;
  498.         }
  499.         else if (dialog_type == SEARCH) {
  500.             search_regex = last_search_regex;
  501.             display search_label;
  502.             display search_regex;
  503.         }
  504.         else if (dialog_type == NEW_FOLDER) {
  505.             new_folder = last_new_folder;
  506.             display new_folder_label;
  507.             display new_folder;
  508.         }
  509.         else if (dialog_type == PIPE) {
  510.             pipe_cmd = last_pipe_cmd;
  511.             display pipe_label;
  512.             display pipe_cmd;
  513.         }
  514.         else if (dialog_type == BURST) {
  515.             burst_opts = last_burst_opts;
  516.             display burst_label;
  517.             display burst_opts;
  518.         }
  519.         else if (dialog_type == DIST) {
  520.             dist_opts = last_dist_opts;
  521.             display dist_label;
  522.             display dist_opts;
  523.         }
  524.         else if (dialog_type == SORT) {
  525.             sort_opts = last_sort_opts;
  526.             display sort_label;
  527.             display sort_opts;
  528.         }
  529.     }
  530.     close {
  531.         if (dialog_type == REFILE) {
  532.             remove refile_label;
  533.             remove refile_folder;
  534.         }
  535.         else if (dialog_type == COMP) {
  536.             remove comp_label;
  537.             remove comp_opts;
  538.         }
  539.         else if (dialog_type == FORW) {
  540.             remove forw_label;
  541.             remove forw_opts;
  542.         }
  543.         else if (dialog_type == REPL) {
  544.             remove repl_label;
  545.             remove repl_opts;
  546.         }
  547.         else if (dialog_type == SEARCH) {
  548.             remove search_label;
  549.             remove search_regex;
  550.         }
  551.         else if (dialog_type == NEW_FOLDER) {
  552.             remove new_folder_label;
  553.             remove new_folder;
  554.         }
  555.         else if (dialog_type == PIPE) {
  556.             remove pipe_label;
  557.             remove pipe_cmd;
  558.         }
  559.         else if (dialog_type == BURST) {
  560.             remove burst_label;
  561.             remove burst_opts;
  562.         }
  563.         else if (dialog_type == DIST) {
  564.             remove dist_label;
  565.             remove dist_opts;
  566.         }
  567.         else if (dialog_type == SORT) {
  568.             remove sort_label;
  569.             remove sort_opts;
  570.         }
  571.     }
  572.     gadgets
  573.         label refile_label
  574.             at 5 5
  575.             "Choose folder to refile to"
  576.         end_label
  577.         button
  578.             normal    "OK" {
  579.                 if (dialog_type == REFILE) {
  580.                     refile_cmd = format("r%s\n", refile_folder);
  581.                     send(refile_cmd);
  582.                     last_refile_folder = refile_folder;
  583.                 }
  584.                 else if (dialog_type == COMP) {
  585.                     comp_cmd = format("c%s\n", comp_opts);
  586.                     send(comp_cmd);
  587.                     last_comp_opts = comp_opts;
  588.                 }
  589.                 else if (dialog_type == FORW) {
  590.                     forw_cmd = format("f%s\n", forw_opts);
  591.                     send(forw_cmd);
  592.                     last_forw_opts = forw_opts;
  593.                 }
  594.                 else if (dialog_type == REPL) {
  595.                     repl_cmd = format("a%s\n", forw_opts);
  596.                     send(repl_cmd);
  597.                     last_repl_opts = repl_opts;
  598.                 }
  599.                 else if (dialog_type == SEARCH) {
  600.                     search_cmd = format("%s%s\n",
  601.                         search_dir, search_regex);
  602.                     send(search_cmd);
  603.                     last_search_regex = search_regex;
  604.                 }
  605.                 else if (dialog_type == NEW_FOLDER) {
  606.                     new_folder_cmd = format("g%s\n",
  607.                         new_folder);
  608.                     send(new_folder_cmd);
  609.                     last_new_folder = new_folder;
  610.                 }
  611.                 else if (dialog_type == PIPE) {
  612.                     pipe_cmd_cmd = format("|%s\n",
  613.                         pipe_cmd);
  614.                     send(pipe_cmd_cmd);
  615.                     last_pipe_cmd = pipe_cmd;
  616.                 }
  617.                 else if (dialog_type == BURST) {
  618.                     burst_cmd = format("b%s\n", burst_opts);
  619.                     send(burst_cmd);
  620.                     last_burst_opts = burst_opts;
  621.                 }
  622.                 else if (dialog_type == DIST) {
  623.                     dist_cmd = format("t%s\n", dist_opts);
  624.                     send(dist_cmd);
  625.                     last_dist_opts = dist_opts;
  626.                 }
  627.                 else if (dialog_type == SORT) {
  628.                     sort_cmd = format("S%s\n", sort_opts);
  629.                     send(sort_cmd);
  630.                     last_sort_opts = sort_opts;
  631.                 }
  632.                 remove dialog_box;
  633.             }
  634.         end_button
  635.         text refile_folder
  636.             display 20
  637.             completion    "\n\e"
  638.             label    "Folder:"
  639.             action    {
  640.                 refile_cmd = format("r%s\n", refile_folder);
  641.                 send(refile_cmd);
  642.                 last_refile_folder = refile_folder;
  643.                 remove dialog_box;
  644.             }
  645.         end_text
  646.         button
  647.             normal    "Cancel"    {
  648.                 remove dialog_box;
  649.             }
  650.         end_button
  651.         label comp_label
  652.             at 5 5
  653.             "Choose arguments for comp"
  654.         end_label
  655.         label forw_label
  656.             at 5 5
  657.             "Choose arguments for forw"
  658.         end_label
  659.         label repl_label
  660.             at 5 5
  661.             "Choose arguments for repl"
  662.         end_label
  663.         label search_label
  664.             at 5 5
  665.             "Subject line search"
  666.         end_label
  667.         label new_folder_label
  668.             at 5 5
  669.             "Choose new folder"
  670.         end_label
  671.         label pipe_label
  672.             at 5 5
  673.             "Pipe message to command"
  674.         end_label
  675.         label burst_label
  676.             at 5 5
  677.             "Choose arguments for burst"
  678.         end_label
  679.         label dist_label
  680.             at 5 5
  681.             "Choose arguments for dist"
  682.         end_label
  683.         label sort_label
  684.             at 5 5
  685.             "Choose arguments for sortm"
  686.         end_label
  687.         text comp_opts
  688.             at 5 30
  689.             display 20
  690.             completion    "\n\e"
  691.             label    "Arguments:"
  692.             action    {
  693.                 comp_cmd = format("c%s\n", comp_opts);
  694.                 send(comp_cmd);
  695.                 last_comp_opts = comp_opts;
  696.                 remove dialog_box;
  697.             }
  698.         end_text
  699.         text forw_opts
  700.             at 5 30
  701.             display 20
  702.             completion    "\n\e"
  703.             label    "Arguments:"
  704.             action    {
  705.                 forw_cmd = format("f%s\n", forw_opts);
  706.                 send(forw_cmd);
  707.                 last_forw_opts = forw_opts;
  708.                 remove dialog_box;
  709.             }
  710.         end_text
  711.         text repl_opts
  712.             at 5 30
  713.             display 20
  714.             completion    "\n\e"
  715.             label    "Arguments:"
  716.             action    {
  717.                 repl_cmd = format("a%s\n", repl_opts);
  718.                 send(repl_cmd);
  719.                 last_repl_opts = repl_opts;
  720.                 remove dialog_box;
  721.             }
  722.         end_text
  723.         text search_regex
  724.             at 5 30
  725.             display 20
  726.             completion    "\n\e"
  727.             label    "Expression:"
  728.             action    {
  729.                 search_cmd = format("%s%s\n", search_dir,
  730.                     search_regex);
  731.                 send(search_cmd);
  732.                 last_search_regex = search_regex;
  733.                 remove dialog_box;
  734.             }
  735.         end_text
  736.         text new_folder
  737.             at 5 30
  738.             display 20
  739.             completion    "\n\e"
  740.             label    "Folder:"
  741.             action    {
  742.                 new_folder_cmd = format("g%s\n", new_folder);
  743.                 send(new_folder_cmd);
  744.                 last_new_folder = new_folder;
  745.                 remove dialog_box;
  746.             }
  747.         end_text
  748.         text pipe_cmd
  749.             at 5 30
  750.             display 20
  751.             completion    "\n\e"
  752.             label    "Command:"
  753.             action    {
  754.                 pipe_cmd_cmd = format("|%s\n", pipe_cmd);
  755.                 send(pipe_cmd_cmd);
  756.                 last_pipe_cmd = pipe_cmd;
  757.                 remove dialog_box;
  758.             }
  759.         end_text
  760.         text burst_opts
  761.             at 5 30
  762.             display 20
  763.             completion    "\n\e"
  764.             label    "Arguments:"
  765.             action    {
  766.                 burst_cmd = format("b%s\n", burst_opts);
  767.                 send(burst_cmd);
  768.                 last_burst_opts = burst_opts;
  769.                 remove dialog_box;
  770.             }
  771.         end_text
  772.         text dist_opts
  773.             at 5 30
  774.             display 20
  775.             completion    "\n\e"
  776.             label    "Arguments:"
  777.             action    {
  778.                 dist_cmd = format("t%s\n", dist_opts);
  779.                 send(dist_cmd);
  780.                 last_dist_opts = dist_opts;
  781.                 remove dialog_box;
  782.             }
  783.         end_text
  784.         text sort_opts
  785.             at 5 30
  786.             display 20
  787.             completion    "\n\e"
  788.             label    "Arguments:"
  789.             action    {
  790.                 sort_cmd = format("S%s\n", sort_opts);
  791.                 send(sort_cmd);
  792.                 last_sort_opts = sort_opts;
  793.                 remove dialog_box;
  794.             }
  795.         end_text
  796.     end_gadgets
  797. end_dialog
  798.  
  799. /*
  800.  * Move cursor to message that the mouse points to.
  801.  */
  802.  
  803. mouse
  804.     base 0 characters
  805.     button left
  806.         normal    {
  807.             scanline = mouse_y - 1;
  808.             send "H";
  809.             while (scanline-- > 1) {
  810.                 send "j";
  811.             }
  812.         }
  813.         shift    {
  814.             scanline = mouse_y - 1;
  815.             send "H";
  816.             while (scanline-- > 1) {
  817.                 send "j";
  818.             }
  819.             send " ";
  820.         }
  821.     end_button
  822. end_mouse
  823. END-OF-TOOLTOOL-SCRIPT
  824.  
  825. exec tooltool -f $TMP "$@"
  826.